<html>
<head><meta charset="utf-8"><title>x.py install issues · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html">x.py install issues</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="244873108"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244873108" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Huszagh (He/Him) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244873108">(Jul 04 2021 at 19:14)</a>:</h4>
<p><span class="user-mention silent" data-user-id="153718">Alexander Huszagh (He/Him)</span> <a href="#narrow/stream/122651-general/topic/Search.20PRs.20for.20a.20file/near/244872964">said</a>:</p>
<blockquote>
<p>Does anyone know why cargo-miri would be using outdated versions of rust-core, from a custom build?</p>
<p>Detailed install instructions, FYI: from a  custom version of rust, from the directory, I first build the package, and then copy the binaries over, and then link the toolchain.</p>
<div class="codehilite" data-code-language="Bash"><pre><span></span><code>./x.py build
cp -a build/x86_64-unknown-linux-gnu/stage2/* ~/cargo_dev/stage2
cp -a build/x86_64-unknown-linux-gnu/stage2-tools-bin/* ~/cargo_dev/stage2/bin/
rustup toolchain link stage2 ~/cargo_dev/stage2
</code></pre></div>
<p>I think clone stock Miri, build and install it, and then test with a trivial package, using my new rust version:</p>
<div class="codehilite" data-code-language="Bash"><pre><span></span><code>rustup default stage2
rustc --version <span class="c1"># rustc 1.55.0-dev</span>
cargo --version <span class="c1"># cargo 1.55.0-dev</span>
git clone https://github.com/rust-lang/miri
<span class="nb">cd</span> miri
./miri build
./miri install
</code></pre></div>
<p>Finally, I think create a dummy package, build, and test to see if it works:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#[cfg(test)]</span><span class="w"></span>
<span class="k">mod</span> <span class="nn">tests</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="cp">#[test]</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">it_works</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="fm">assert_eq!</span><span class="p">(</span><span class="mi">2</span><span class="k">u8</span><span class="p">.</span><span class="n">wrapping_sub</span><span class="p">(</span><span class="mi">3</span><span class="k">u8</span><span class="p">),</span><span class="w"> </span><span class="mi">255</span><span class="k">u8</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>

<span class="w">    </span><span class="cp">#[test]</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">many_digits</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">s</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">"0."</span><span class="p">.</span><span class="n">to_string</span><span class="p">();</span><span class="w"></span>
<span class="w">        </span><span class="k">for</span><span class="w"> </span><span class="n">_</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="mi">0</span><span class="o">..</span><span class="mi">375</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">s</span><span class="p">.</span><span class="n">push</span><span class="p">(</span><span class="sc">'3'</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">        </span><span class="c1">// there's an older version that has an arithmetic overflow, which is expected, but didn't use wrapping_sub.</span>
<span class="w">       </span><span class="c1">// this therefore fails on the old library/core, but not on the new one.</span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">_</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">s</span><span class="p">.</span><span class="n">parse</span>::<span class="o">&lt;</span><span class="kt">f64</span><span class="o">&gt;</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>

<span class="w">    </span><span class="cp">#[test]</span><span class="w"></span>
<span class="w">    </span><span class="cp">#[should_panic]</span><span class="w"></span>
<span class="w">    </span><span class="cp">#[allow(arithmetic_overflow)]</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">fails</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="fm">assert_eq!</span><span class="p">(</span><span class="mi">2</span><span class="k">u8</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">3</span><span class="k">u8</span><span class="p">,</span><span class="w"> </span><span class="mi">255</span><span class="k">u8</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>Running <code>cargo miri test</code> fails no matter how many times I try to rebuild rust, miri. I've also tried doing clean uninstalls of the toolchain by rebuilding the toolchain, deleting <code>~/cargo_dev/stage2</code>, deleting the <code>miri</code> directory, re-cloning, and rebuilding.</p>
</blockquote>



<a name="244873214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244873214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Huszagh (He/Him) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244873214">(Jul 04 2021 at 19:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="153718">Alexander Huszagh (He/Him)</span> <a href="#narrow/stream/122651-general/topic/Search.20PRs.20for.20a.20file/near/244872997">said</a>:</p>
<blockquote>
<p>Attempting to change the actual code in libcore to say, not have a wrapping sub (and using an i8, rather than u8, with then a cast back, as a hack), doesn't do anything... I'm very much lost.</p>
</blockquote>



<a name="244873232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244873232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Huszagh (He/Him) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244873232">(Jul 04 2021 at 19:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="153718">Alexander Huszagh (He/Him)</span> <a href="#narrow/stream/122651-general/topic/Search.20PRs.20for.20a.20file/near/244873049">said</a>:</p>
<blockquote>
<p>Attempting to do <code>./x.py install</code> fails, due to errors in <code>docs</code> (cannot find a library, since it uses nightly and not beta), and then removing that I have failures in <code>rustfmt</code>.</p>
</blockquote>



<a name="244873445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244873445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Huszagh (He/Him) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244873445">(Jul 04 2021 at 19:22)</a>:</h4>
<p>Likewise, even if I disable everything besides <code>cargo</code>, libunwind fails. I've tried setting it system, which always fails.</p>



<a name="244873702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244873702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> The 8472 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244873702">(Jul 04 2021 at 19:29)</a>:</h4>
<p>Have you tried <code>./x.py build src/tools/miri --stage 1</code>? That builds it from the git submodule pointing to the original repo</p>



<a name="244873780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244873780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Huszagh (He/Him) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244873780">(Jul 04 2021 at 19:31)</a>:</h4>
<p><span class="user-mention" data-user-id="330154">@The 8472</span> I have done a full build, and then tried to copy the binaries over, and miri seems to be properly built and installed (stage 1 or stage 2).</p>
<div class="codehilite" data-code-language="Bash"><pre><span></span><code>$ ~/.rustup/toolchains/cdev/bin/miri --version
rustc <span class="m">1</span>.55.0-dev
</code></pre></div>
<p>However, cargo-miri is not installed in that location (is that an issue)?</p>



<a name="244873827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244873827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Huszagh (He/Him) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244873827">(Jul 04 2021 at 19:32)</a>:</h4>
<p>The build log also shows miri being built.</p>



<a name="244874269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244874269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> The 8472 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244874269">(Jul 04 2021 at 19:44)</a>:</h4>
<p><code>./x.py build src/tools/miri/cargo-miri --stage 1</code> builds that. It's a separate wrapper executable.</p>



<a name="244874287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244874287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Huszagh (He/Him) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244874287">(Jul 04 2021 at 19:45)</a>:</h4>
<p>Ah perfect, that seems to be working.</p>



<a name="244874352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244874352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Huszagh (He/Him) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244874352">(Jul 04 2021 at 19:46)</a>:</h4>
<p>Relatively new to internal rust tooling (IE, building rust from scratch, etc.), so this is extremely helpful, thank you.</p>



<a name="244874468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244874468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> The 8472 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244874468">(Jul 04 2021 at 19:50)</a>:</h4>
<p>note that miri isn't guaranteed to build for all commits on nightly, it'll be fixed and updated in a delayed fashion. you'll have to check <a href="https://rust-lang-nursery.github.io/rust-toolstate/">https://rust-lang-nursery.github.io/rust-toolstate/</a></p>



<a name="244874614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244874614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Huszagh (He/Him) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244874614">(Jul 04 2021 at 19:53)</a>:</h4>
<p>Ok, it's not working: it installs fine, but it doesn't seem to use the work and still gives the overflow error. It's weird, everything else works fine.</p>



<a name="244874642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244874642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Huszagh (He/Him) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244874642">(Jul 04 2021 at 19:53)</a>:</h4>
<p>It builds, it just doesn't work. I'm basing off of rust-lang/rust commit 868c702d0c9.</p>



<a name="244874858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244874858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> The 8472 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244874858">(Jul 04 2021 at 19:58)</a>:</h4>
<p>By "doesn't work" you mean it's not running with the changes you made to std? I don't know what's causing that. Maybe some environment vars not being set correctly by rustup or something? Idk.</p>



<a name="244874981"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244874981" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Huszagh (He/Him) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244874981">(Jul 04 2021 at 20:02)</a>:</h4>
<p>Yeah, sorry, that's what I mean. Using the above <code>lib.rs</code> in a standalone crate, I get the following output:</p>
<div class="codehilite" data-code-language="Bash"><pre><span></span><code>$ <span class="nv">RUSTFLAGS</span><span class="o">=</span><span class="s2">"-C overflow-checks=n"</span> cargo miri <span class="nb">test</span>
running <span class="m">3</span> tests
<span class="nb">test</span> tests::fails - should panic ... ok
<span class="nb">test</span> tests::it_works ... ok
<span class="nb">test</span> tests::many_digits ... FAILED

failures:

---- tests::many_digits stdout ----
thread <span class="s1">'main'</span> panicked at <span class="s1">'attempt to subtract with overflow'</span>, /home/ahuszagh/git/rust/library/core/src/num/dec2flt/parse.rs:40:25

$ cargo miri <span class="nb">test</span>
running <span class="m">3</span> tests
<span class="nb">test</span> tests::fails - should panic ... FAILED
<span class="nb">test</span> tests::it_works ... ok
<span class="nb">test</span> tests::many_digits ... FAILED

failures:

---- tests::fails stdout ----
note: <span class="nb">test</span> did not panic as expected
---- tests::many_digits stdout ----
thread <span class="s1">'main'</span> panicked at <span class="s1">'attempt to subtract with overflow'</span>, /home/ahuszagh/git/rust/library/core/src/num/dec2flt/parse.rs:40:25
note: run with <span class="sb">`</span><span class="nv">RUST_BACKTRACE</span><span class="o">=</span><span class="m">1</span><span class="sb">`</span> environment variable to display a backtrace


failures:
    tests::fails
    tests::many_digits
</code></pre></div>



<a name="244875022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244875022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Huszagh (He/Him) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244875022">(Jul 04 2021 at 20:02)</a>:</h4>
<p>Maybe, let me check...</p>



<a name="244875612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244875612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Huszagh (He/Him) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244875612">(Jul 04 2021 at 20:17)</a>:</h4>
<p>Ah I think I found it. For some reason, <code>~/.cache/miri/HOST</code> isn't getting overwritten.</p>



<a name="244875619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244875619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Huszagh (He/Him) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244875619">(Jul 04 2021 at 20:17)</a>:</h4>
<p>Just doing <code>rm -rf ~/.cache/miri/HOST</code> works, and then it just "works".</p>



<a name="244875664"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/x.py%20install%20issues/near/244875664" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Huszagh (He/Him) <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/x.2Epy.20install.20issues.html#244875664">(Jul 04 2021 at 20:18)</a>:</h4>
<p>Thanks for all the help <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>